\(\int \sqrt {a+b \cos (x)} \tan (x) \, dx\) [19]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [F(-1)]

Optimal result

Integrand size = 13, antiderivative size = 37 \[ \int \sqrt {a+b \cos (x)} \tan (x) \, dx=2 \sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+b \cos (x)}}{\sqrt {a}}\right )-2 \sqrt {a+b \cos (x)} \]

[Out]

2*arctanh((a+b*cos(x))^(1/2)/a^(1/2))*a^(1/2)-2*(a+b*cos(x))^(1/2)

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {2800, 52, 65, 213} \[ \int \sqrt {a+b \cos (x)} \tan (x) \, dx=2 \sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+b \cos (x)}}{\sqrt {a}}\right )-2 \sqrt {a+b \cos (x)} \]

[In]

Int[Sqrt[a + b*Cos[x]]*Tan[x],x]

[Out]

2*Sqrt[a]*ArcTanh[Sqrt[a + b*Cos[x]]/Sqrt[a]] - 2*Sqrt[a + b*Cos[x]]

Rule 52

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(a + b*x)^(m + 1)*((c + d*x)^n/(b*(
m + n + 1))), x] + Dist[n*((b*c - a*d)/(b*(m + n + 1))), Int[(a + b*x)^m*(c + d*x)^(n - 1), x], x] /; FreeQ[{a
, b, c, d}, x] && NeQ[b*c - a*d, 0] && GtQ[n, 0] && NeQ[m + n + 1, 0] &&  !(IGtQ[m, 0] && ( !IntegerQ[n] || (G
tQ[m, 0] && LtQ[m - n, 0]))) &&  !ILtQ[m + n + 2, 0] && IntLinearQ[a, b, c, d, m, n, x]

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 2800

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(p_.), x_Symbol] :> Dist[1/f, Subst[I
nt[(x^p*(a + x)^m)/(b^2 - x^2)^((p + 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x] && NeQ[a^2
 - b^2, 0] && IntegerQ[(p + 1)/2]

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {\sqrt {a+x}}{x} \, dx,x,b \cos (x)\right ) \\ & = -2 \sqrt {a+b \cos (x)}-a \text {Subst}\left (\int \frac {1}{x \sqrt {a+x}} \, dx,x,b \cos (x)\right ) \\ & = -2 \sqrt {a+b \cos (x)}-(2 a) \text {Subst}\left (\int \frac {1}{-a+x^2} \, dx,x,\sqrt {a+b \cos (x)}\right ) \\ & = 2 \sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+b \cos (x)}}{\sqrt {a}}\right )-2 \sqrt {a+b \cos (x)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.00 \[ \int \sqrt {a+b \cos (x)} \tan (x) \, dx=2 \sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+b \cos (x)}}{\sqrt {a}}\right )-2 \sqrt {a+b \cos (x)} \]

[In]

Integrate[Sqrt[a + b*Cos[x]]*Tan[x],x]

[Out]

2*Sqrt[a]*ArcTanh[Sqrt[a + b*Cos[x]]/Sqrt[a]] - 2*Sqrt[a + b*Cos[x]]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(122\) vs. \(2(29)=58\).

Time = 2.23 (sec) , antiderivative size = 123, normalized size of antiderivative = 3.32

method result size
default \(-2 \sqrt {-2 b \left (\sin ^{2}\left (\frac {x}{2}\right )\right )+a +b}+\sqrt {a}\, \ln \left (\frac {4 \cos \left (\frac {x}{2}\right ) b \sqrt {2}+4 \sqrt {a}\, \sqrt {-2 b \left (\sin ^{2}\left (\frac {x}{2}\right )\right )+a +b}+4 a -4 b}{2 \cos \left (\frac {x}{2}\right )-\sqrt {2}}\right )+\sqrt {a}\, \ln \left (-\frac {4 \left (\cos \left (\frac {x}{2}\right ) b \sqrt {2}-\sqrt {a}\, \sqrt {-2 b \left (\sin ^{2}\left (\frac {x}{2}\right )\right )+a +b}-a +b \right )}{2 \cos \left (\frac {x}{2}\right )+\sqrt {2}}\right )\) \(123\)

[In]

int((a+cos(x)*b)^(1/2)*tan(x),x,method=_RETURNVERBOSE)

[Out]

-2*(-2*b*sin(1/2*x)^2+a+b)^(1/2)+a^(1/2)*ln(4/(2*cos(1/2*x)-2^(1/2))*(cos(1/2*x)*b*2^(1/2)+a^(1/2)*(-2*b*sin(1
/2*x)^2+a+b)^(1/2)+a-b))+a^(1/2)*ln(-4/(2*cos(1/2*x)+2^(1/2))*(cos(1/2*x)*b*2^(1/2)-a^(1/2)*(-2*b*sin(1/2*x)^2
+a+b)^(1/2)-a+b))

Fricas [A] (verification not implemented)

none

Time = 0.40 (sec) , antiderivative size = 109, normalized size of antiderivative = 2.95 \[ \int \sqrt {a+b \cos (x)} \tan (x) \, dx=\left [\frac {1}{2} \, \sqrt {a} \log \left (-\frac {b^{2} \cos \left (x\right )^{2} + 8 \, a b \cos \left (x\right ) + 4 \, {\left (b \cos \left (x\right ) + 2 \, a\right )} \sqrt {b \cos \left (x\right ) + a} \sqrt {a} + 8 \, a^{2}}{\cos \left (x\right )^{2}}\right ) - 2 \, \sqrt {b \cos \left (x\right ) + a}, -\sqrt {-a} \arctan \left (\frac {2 \, \sqrt {b \cos \left (x\right ) + a} \sqrt {-a}}{b \cos \left (x\right ) + 2 \, a}\right ) - 2 \, \sqrt {b \cos \left (x\right ) + a}\right ] \]

[In]

integrate((a+b*cos(x))^(1/2)*tan(x),x, algorithm="fricas")

[Out]

[1/2*sqrt(a)*log(-(b^2*cos(x)^2 + 8*a*b*cos(x) + 4*(b*cos(x) + 2*a)*sqrt(b*cos(x) + a)*sqrt(a) + 8*a^2)/cos(x)
^2) - 2*sqrt(b*cos(x) + a), -sqrt(-a)*arctan(2*sqrt(b*cos(x) + a)*sqrt(-a)/(b*cos(x) + 2*a)) - 2*sqrt(b*cos(x)
 + a)]

Sympy [F]

\[ \int \sqrt {a+b \cos (x)} \tan (x) \, dx=\int \sqrt {a + b \cos {\left (x \right )}} \tan {\left (x \right )}\, dx \]

[In]

integrate((a+b*cos(x))**(1/2)*tan(x),x)

[Out]

Integral(sqrt(a + b*cos(x))*tan(x), x)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.24 \[ \int \sqrt {a+b \cos (x)} \tan (x) \, dx=-\sqrt {a} \log \left (\frac {\sqrt {b \cos \left (x\right ) + a} - \sqrt {a}}{\sqrt {b \cos \left (x\right ) + a} + \sqrt {a}}\right ) - 2 \, \sqrt {b \cos \left (x\right ) + a} \]

[In]

integrate((a+b*cos(x))^(1/2)*tan(x),x, algorithm="maxima")

[Out]

-sqrt(a)*log((sqrt(b*cos(x) + a) - sqrt(a))/(sqrt(b*cos(x) + a) + sqrt(a))) - 2*sqrt(b*cos(x) + a)

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 34, normalized size of antiderivative = 0.92 \[ \int \sqrt {a+b \cos (x)} \tan (x) \, dx=-\frac {2 \, a \arctan \left (\frac {\sqrt {b \cos \left (x\right ) + a}}{\sqrt {-a}}\right )}{\sqrt {-a}} - 2 \, \sqrt {b \cos \left (x\right ) + a} \]

[In]

integrate((a+b*cos(x))^(1/2)*tan(x),x, algorithm="giac")

[Out]

-2*a*arctan(sqrt(b*cos(x) + a)/sqrt(-a))/sqrt(-a) - 2*sqrt(b*cos(x) + a)

Mupad [F(-1)]

Timed out. \[ \int \sqrt {a+b \cos (x)} \tan (x) \, dx=\int \mathrm {tan}\left (x\right )\,\sqrt {a+b\,\cos \left (x\right )} \,d x \]

[In]

int(tan(x)*(a + b*cos(x))^(1/2),x)

[Out]

int(tan(x)*(a + b*cos(x))^(1/2), x)